﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace ArchiveIISLogs
{
    class Config
    {
        public static string GetFileExtensionToCompress() { return ConfigurationManager.AppSettings["FileExtensionToCompress"].ToString(); }
        public static string GetMachineWebLogsDirectory() { return ConfigurationManager.AppSettings["MachineWebLogsDirectory"].ToString(); }
        public static string GetWebLogFilePrefix() { return ConfigurationManager.AppSettings["WebLogFilePrefix"].ToString(); }

        const int DEFAULT_DAYS_PREVIOUS = 30; //if malformed 'daysprevious' value; default to this
        public static int GetRetensionInDays()
        {
            string configValue = ConfigurationManager.AppSettings["LogRentionInDays"].ToString();

            int daysPrevious = DEFAULT_DAYS_PREVIOUS;
            int.TryParse(configValue, out daysPrevious);
            return daysPrevious;
        }
    }
}
